package org.teacup.eightdays.util;

import java.io.IOException;
import java.util.Properties;

public class PropertiesLoaderUtil extends Properties {
	private static final long serialVersionUID = 2247643357948649805L;

	private PropertiesLoaderUtil() {
		super();
	}

	private static PropertiesLoaderUtil instance;
	private static String location;

	public static PropertiesLoaderUtil newInstance(String location) {
		if (instance == null || PropertiesLoaderUtil.location != location) {
			try {
				instance = new PropertiesLoaderUtil();
				instance.load(PropertiesLoaderUtil.class
						.getResourceAsStream(location));
			} catch (IOException e) {
				e.printStackTrace();
			}
		}

		return instance;
	}

}
